<?php 
require_once 'sesi_login.php';
require_once 'konfigurasi.php';

fungsi('pengguna');


define('PAGE', 'Admin Materi');
define('PAGE_ICO', 'icon-stats');
define('PAGE_URL', 'admin_materi.php');

panggil_header();

koneksi_buka();

$text_q_materi = "select *, a.id as m_id, a.nama as m_nama, b.tipe as k_nama from materi a left join kelas b on a.tipe_kelas = b.tipe group by a.id";
$q_materi = mysql_query($text_q_materi);
?>

<div class="content">
                
	<div class="page-header">
		<div class="icon">
			<span class="ico-arrow-right"></span>
		</div> 
		<h1> Materi<small>SDN I</small></h1>
	</div>
	
	<div class="row-fluid">
		<div class="span12">
			<div class="block">
				<div class="head purple">
					<div class="icon"><span class="ico-book-3"></span></div>
					<h2>Daftar Materi</h2>
					<ul class="buttons">
						<li><a href="#" onClick="source('table_hover'); return false;"><div class="icon"><span class="ico-info"></span></div></a></li>
					</ul> 
					<ul class="buttons">
						<li><a id="tambah-materi" href="#"><div class="icon"><span class="ico-plus-sign"></span></div></a></li>
					</ul>                      
					                                                         
				</div>                
				<div class="data-fluid">
					<table cellpadding="0" cellspacing="0" width="100%" class="table fpTable lcnp">
						<thead>
							<tr>
								<th width="10%">
									Id Materi
								</th>
								<th width="35%">
									Nama Materi
								</th>
								<th width="20%">
									Kelas
								</th>
								<th width="15%">
									Pertemuan
								</th>
								<th class="TAC" width="20%">
									Operation
								</th>
							</tr>
						</thead>
						<tbody>
							<?php 
								while($dt_materi = mysql_fetch_array($q_materi)){
									?>
								
									<tr>
										<td>
											<?php echo $dt_materi['m_id']; ?>
										</td>
										<td>
											<a href="<?php echo $dt_materi['file']; ?>"><?php echo $dt_materi['m_nama']; ?></a>										
										</td>
										<td>
											<?php echo $dt_materi['k_nama']; ?>										
										</td>
										<td>
											<?php echo $dt_materi['pertemuan_ke']; ?>										
										</td>
										<td>
											<a href="#" class="button green">
												<div class="icon"><span class="ico-pencil"></span></div>
											</a>
											<a href="#" class="button red">
												<div class="icon"><span class="ico-remove"></span></div>
											</a>                                              
										</td>
									</tr>
							<?php } ?>
						</tbody>
					</table>
				</div>							 
			</div>
		</div>
	</div>
</div>

<div id="dialog-tambah-materi" style="display:none;">
	<?php
		require_once 'modul/admin_materi/tambah_materi.php';
	?>
</div>

<div class="dialog" id="source" style="display: none;" title="Source"></div>

<?php
panggil_footer();
?>
